//
// Created by whg on 2025-06-02.
//

#ifndef PYVM_2025_INTERPRETER_HPP
#define PYVM_2025_INTERPRETER_HPP


#include "code/codeObject.hpp"
#include "frameObject.hpp"

class Interpreter {
private:
    FrameObject* _frame;
    Map<PyObject*, PyObject*>* _builtins;

public:
    Interpreter();
    void run(CodeObject* code);

private:
    void setPc(int pc){
        _frame->setPc(pc);
    }
    int getPc(){
        return _frame->getPc();
    }
    PyList* names(){
        return _frame->names();
    }
    Map<PyObject*, PyObject*>* locals(){
        return _frame->locals();
    }
    Map<PyObject*, PyObject*>* globals(){
        return _frame->globals();
    }
    ArrayList<PyObject*>* fastLocals(){
        return _frame->fastLocals();
    }
    PyList* consts(){
        return _frame->consts();
    }

    void newFrame(FunctionObject* func, ArrayList<PyObject*>* args);
    void delFrame(PyObject* returnValue);
};


#endif //PYVM_2025_INTERPRETER_HPP
